# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import tensorflow as tf
from easydict import EasyDict

_C = EasyDict()

# dataconfig


#   Model Arts Config 
_C.TRAINING_FILENAMES_OBS_PATH = 'obs://ma-iranb/data/squeezenet/train'
_C.VALIDATION_FILENAMES_OBS_PATH = 'obs://ma-iranb/data/squeezenet/valid'
_C.TEST_FILENAMES_OBS_PATH = 'obs://ma-iranb/data/squeezenet/test'

_C.TRAINING_FILENAMES_cache_PATH = '/cache/squeezenet/data/tfrecords/train'
_C.VALIDATION_FILENAMES_cache_PATH = '/cache/squeezenet/data/tfrecords/valid'
_C.TEST_FILENAMES_cache_PATH = '/cache/squeezenet/data/tfrecords/test'




# _C.TRAINING_FILENAMES = '/media/data1/haoyiqing/code/0000000-Useful-Code/03-Squeeze-net/data/data/tfrecords/train'
# _C.VALIDATION_FILENAMES = '/media/data1/haoyiqing/code/0000000-Useful-Code/03-Squeeze-net/data/data/tfrecords/valid'


# Moddel Config
_C.bnmomemtum=0.9
_C.IMAGE_SIZE = 64

# Train Config
# tf record --per class 500 train--  --per class 50 val, -- per class 50 test class = 200
_C.EPOCHS = 35
_C.BATCH_SIZE = 256 * 2
_C.STEPS_PER_EPOCH = 401 // 2
_C.EPOCHS = 2000
_C.VALIDATION_STEPS = 10

# CheckPoint Config
_C.CHECKPOINTS = '/cache/squeeze/checkpoints/weights_best.hdf5'
_C.OBS_CKPT_PATH = 'obs://ma-iranb/ckpt/squeezenet/weights_best.hdf5'

def ensure_dir(file_path):
    directory = os.path.dirname(file_path)
    if not os.path.exists(directory):
        print("create dir",directory)
        os.makedirs(directory)
ensure_dir(_C.CHECKPOINTS)